/*
 * @Author: czy
 * @Date: 2021-05-21 14:27:51
 * @LastEditTime: 2021-05-21 22:21:20
 */
#include "dev/hardware/uart.h"
#include "dev/hardware/vga.h"

/**
 * @description: Output a string to the output device.
 * @param buf   Buffer.
 * @param fd    Equipment number, -1 for uart, 1 for vga, 0 for uart and vga.
 * @return Number of output characters.
 */
int write(char *buf, int fd)
{
    int num;
    if (fd >= 0)
    {
        num = vga_put_chars(buf);
    }
    if (fd <= 0)
    {
        num = uart_put_chars(buf);
    }
    return num;
}
